﻿<%@ Page Title="NDF交易資料" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="NDFTrade.aspx.cs" Inherits="NDFTrade"%>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style4
        {
            color: #FF0000;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <p>
        資料日期：<asp:TextBox ID="reportDate" runat="server"></asp:TextBox>
    &nbsp;
        <asp:Button ID="queryBtn" runat="server" Text="取得交易資料" 
            onclick="queryBtn_Click" />
    &nbsp;<asp:Button ID="exportToCsv" runat="server" onclick="exportToCsv_Click" 
            Text="匯出到CSV" />
    </p>
    <p>
        <asp:GridView ID="GridView1" runat="server" 
            AutoGenerateColumns="False" DataSourceID="SqlDataSource1" CellPadding="4" 
            ForeColor="#333333" GridLines="None" 
            DataKeyNames="id,ProductType,SequenceNo,TradeDate" 
            ondatabound="GridView1_DataBound">
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <Columns>
                <asp:BoundField DataField="ProductType" HeaderText="ProductType" 
                    SortExpression="ProductType" ReadOnly="True" />
                <asp:BoundField DataField="SequenceNo" HeaderText="SequenceNo" 
                    SortExpression="SequenceNo" ReadOnly="True" />
                <asp:BoundField DataField="BankCode" HeaderText="BankCode" 
                    SortExpression="BankCode" />
                <asp:BoundField DataField="BankType" HeaderText="BankType" 
                    SortExpression="BankType" />
                <asp:BoundField DataField="TransUnit" HeaderText="TransUnit" 
                    SortExpression="TransUnit" />
                <asp:BoundField DataField="CptyType" HeaderText="CptyType" 
                    SortExpression="CptyType" />
                <asp:BoundField DataField="CptyName" HeaderText="CptyName" 
                    SortExpression="CptyName" />
                <asp:BoundField DataField="CptyCode" HeaderText="CptyCode" 
                    SortExpression="CptyCode" />
                <asp:BoundField DataField="TransReason" HeaderText="TransReason" 
                    SortExpression="TransReason" />
                <asp:BoundField DataField="TradeDate" HeaderText="TradeDate" 
                    SortExpression="TradeDate" ReadOnly="True" DataFormatString="{0:d}" />
                <asp:BoundField DataField="EffectiveDate" HeaderText="EffectiveDate" 
                    SortExpression="EffectiveDate" DataFormatString="{0:d}" />
                <asp:BoundField DataField="MaturityDate" HeaderText="MaturityDate" 
                    SortExpression="MaturityDate" DataFormatString="{0:d}" />
                <asp:BoundField DataField="BuyCcy" HeaderText="BuyCcy" 
                    SortExpression="BuyCcy" />
                <asp:BoundField DataField="BuyNotional" HeaderText="BuyNotional" 
                    SortExpression="BuyNotional" />
                <asp:BoundField DataField="SellCcy" HeaderText="SellCcy" 
                    SortExpression="SellCcy" />
                <asp:BoundField DataField="SellNotional" HeaderText="SellNotional" 
                    SortExpression="SellNotional" />
                <asp:BoundField DataField="CcyPair" HeaderText="CcyPair" 
                    SortExpression="CcyPair" />
                <asp:BoundField DataField="NDFSettleCcy" 
                    HeaderText="NDFSettleCcy" SortExpression="NDFSettleCcy" />
                <asp:BoundField DataField="SwapPoint" HeaderText="SwapPoint" 
                    SortExpression="SwapPoint" />
            </Columns>
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <EmptyDataTemplate>
                執行結果： 
                <br />
                <span class="style4">您輸入的資料日期，目前查無符合資料！</span>
            </EmptyDataTemplate>
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:FEIBConnectionString %>" 
            
            
            SelectCommand="SELECT * FROM [TR_FormatA_FX] WHERE (([TradeDate] = @TradeDate) AND ([TradeType] = @TradeType))">
            <SelectParameters>
                <asp:ControlParameter ControlID="reportDate" Name="TradeDate" 
                    PropertyName="Text" Type="DateTime" />
                <asp:Parameter DefaultValue="FXFWD_NDF" Name="TradeType" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
&nbsp;<asp:CalendarExtender ID="reportDate_CalendarExtender" runat="server" 
            Enabled="True" Format="yyyy/MM/dd" TargetControlID="reportDate">
        </asp:CalendarExtender>
    </p>
</asp:Content>

